/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package sochishun.ucl;

import java.io.File;
import javax.swing.filechooser.FileFilter;

/**
 *
 * @author SoChishun
 */
public class ExcelFileFilter extends FileFilter {

    @Override
    public boolean accept(File f) {
        if(f.isDirectory()){
            return true;
        }
        String filename = f.getName();
        int ipos=filename.lastIndexOf('.');
        if(ipos<0){
            return false;
        }
        String ext=filename.substring(ipos+1).toLowerCase();
        return ext.equals("xls") || ext.equals("xlsx");
    }

    @Override
    public String getDescription() {
        return "电子表格文件(*.xls|*.xlsx)";
    }
    
}
